package com.ch03.shili;

import org.junit.Test;


public class test {
    @Test
    public void test(){
        NewsDao dao = SimpleDaoFactory.getInstance("mysql");
        NewsSerciceImpl sercice = new NewsSerciceImpl();
        sercice.setDao(dao);
    }

    @Test
    public void Shili5(){
        AbstractFactory factory = new MySqlDaoFactory();
        NewsDao dao = factory.getInstance();
        NewsSerciceImpl sercice = new NewsSerciceImpl();
        sercice.setDao(dao);
    }

    @Test
    public void Shili6(){
        Buyer buyer = new IntermediaryImpl(new RealBuyer());
        String result = buyer.havealook();
        System.out.println(result);
    }

    @Test
    public void Shili7(){
        RealBuyer buyer = new IntermediarySubclass();
        String result = buyer.havealook();
        System.out.println(result);
    }
    @Test
    public void Shili8(){
        Buyer buyer = IntermediaryJdkProxyFactory.create(new RealBuyer());
        String result = buyer.havealook();
        System.out.println(result);
    }
    @Test
    public void Shili9(){
//        RealBuyer buyer = IntermediaryCglibProxyFactory.create(RealBuyer.class);
//        String result = buyer.havealook();
//        System.out.println(result);
    }
}
